Stepwise Program Derivation
نویسنده
چکیده
Our understanding of the program derivation process has evolved to the point where it can be described in terms of a clearly defined sequence of steps. In this paper, we will identify those steps and show how they may be used to derive programs from formal specifications. In describing the program derivation process we will focus on two things, its broad structure, and some detail for each of the principal steps. The suggestions made are practical and easily integrated with conventional methodologies for handling larger problems. The detailed steps described also provide the basis for the construction of a system for computer-assisted program derivation from formal specifications. 1. THE STRUCTURE OF THE PROGRAM DERIVATION PROCESS The ideal we seek in program derivation is to begin with a formal specification of a problem, and then to proceed by a well-defined process of transformation and refinement until eventually a program implementation is derived. The process should be constructive, that is, at each stage in the development, the original, or derived specifications, should guide the process. The process we will present here describes a sequence of heuristics which aspire to that ideal. It is best suited to deriving programs for precisely specified problems that require either single or nested loop structures. Such structures represent the building blocks for larger, more elaborate program structures. The task of handling these larger structures becomes one of identifying well-defined and precisely specified sub-problems, deriving their solutions, and composing them accordingly. We are fortunate that a large class of problems, but not all, submit easily to this kind of treatment. The structure of the derivation process, at its broadest interpretation, involves essentially three distinct phases. Phase I Obtaining a Suitable Primary Specification Identification of a precondition/postcondition specification (Q,R) that is deemed to be suitable to guide the formal derivation process. A by-product of this phase is an appropriate initialization for the iterative structure. Phase II Obtaining Secondary Specifications Identification of ancillary specifications, and commands that may be used directly to guide the derivation of the body of the iterative structure. A by-product of this phase is the identification of the guard for the iterative structure. Phase III Derivation of the Body of the Iterative Structure Use of the results from the second phase to derive the body of the iterative structure. (In the course of this phase the need to derive additional iterative structures may be discovered such structures must be derived accordingly.)
منابع مشابه
An extension of the program derivation format
A convention is proposed for embedding program statements into Dijkstra’s calculus, with the aim of simplifying the stepwise construction of programs.
متن کاملAlgebra of programming in Agda: Dependent types for relational program derivation
Relational program derivation is the technique of stepwise refining a relational specification to a program by algebraic rules. The program thus obtained is correct by construction. Meanwhile, dependent type theory is rich enough to express various correctness properties to be verified by the type checker. We have developed a library, AoPA, to encode relational derivations in the dependently ty...
متن کاملProgram Repair by Stepwise Correctness Enhancement
Relative correctness is the property of a program to be more-correct than another with respect to a given specification. Whereas the traditional definition of (absolute) correctness divides candidate program into two classes (correct, and incorrect), relative correctness arranges candidate programs on the richer structure of a partial ordering. In other venues we discuss the impact of relative ...
متن کاملProgram Derivation Using the Refinement Calculator
The refinement calculus provides a theory for the stepwise refinement of programs and this theory has been formalised in HOL. TkWinHOL is a powerful graphical user interface (GUI) that can be used to drive the HOL window Library. In this paper, we describe a tool called the Refinement Calculator which combines TkWinHOL and the HOL Refinement Calculus theory, to provide support for formal progra...
متن کاملCombining Top-Down and Bottom-Up Techniques in Program Derivation
The traditional stepwise refinement based program derivation methodologies are primarily top-down. Strictly following the topdown program derivation approach may require backtracking resulting in rework. Moreover, the top down approach does not directly help in suggesting the next course of action in case of a failed derivation attempt. In this work we seamlessly incorporate a bottom up assumpt...
متن کاملSpecication of a Microprocessor
The action system framework for modelling parallel programs is used to formally specify a microprocessor. First the microprocessor is specied as a sequential program. The sequential specication is then rened into a concurrent program using correctness-preserving program transformations. Previously a similar derivation was carried out informally within the CSP-framework at Caltech, where also a ...
متن کامل